| PIZZA |
Current compiler version:
0.39d
|
| A substantial companion
to Java |
Frequently Asked Questions (with Answers)
Pizza and Java
|
How can I generate Java code as the output
of the compiler, rather than class
files? |
Use the -s option to translate the given Pizza sources into the
equivalent .java files, which the compiler will place in the class
directories.
| Using the Java reflection API, I can find the
names, types and values of object fields at runtime. What happens
when the fields have function types or other Pizza
types? |
Currently, reflection on Pizza
types returns nothing meaningful - Pizza mangles its type names rather
severely. The compiler was developed before we knew about the the
reflection API. A future release of the compiler will be
non-mangling, and at that time we will document the protocols for the
debugging and reflection API's.
I'd like to use Pizza to generate abstract
syntax trees (AST's) for Java programs. Is there a compiler
switch that will output AST's? If not, how can I access the
them? |
The Pizza Compiler generates AST's internally but does not support any
output format for AST's. Using the compiler source code, you can
operate on the AST data structures directly. However, the structures
are fairly complicated, and would require a fair understanding of
compiler construction in general.
When I compile my Pizza code into Java, I
see several lines of the type
throw new Error();
// inserted for safety. What kind of error do they
indicate? |
These statements are inserted during the translation of pattern
matching. The compiler translates the (arbitrarily deep)
switch statements into single-level tests. These tests
should be exhaustive, but just to be certain, these lines are inserted
as a default to catch a miss by all of the cases.It is possible to
cause one of these errors by creating a subclass of an algebraic data
type. If your program raises one of these errors otherwise, it could
be an error in the compiler, so please file a bug report.
Page design & maintenance: John Maraist.
Answers by Martin Odersky, Christian Kemper, Enno Runne and John
Maraist.
Java is a trademark of Sun Microsystems.
Comments and bug reports to the Pizza Group, pizza@cis.unisa.edu.au.
All software and documents on the Pizza site are © Copyright
1996, 1997 by the respective authors (as attributed on each; terms for
redistribution are available).